package mysql

import "gorm.io/gorm"

type Style struct {
	gorm.Model
	Name string `gorm:"type:varchar(11);not null;comment:类别名"`
}

func (s *Style) FindStyleByName(db *gorm.DB, name string) error {
	return db.Debug().Where("name=?", name).First(s).Error
}

//func (s *Style) FindStyle(db *gorm.DB, name string) error {
//	return db.Debug().Where("name=?", name).FirstOrCreate(&s).Error
//}

func (s *Style) StyleCreate(db *gorm.DB) error {
	return db.Debug().Create(s).Error
}
